<template>
  <div class="app-data">
    <div class="common-content cont-main">
      <EchartTrail :list="data"></EchartTrail>
    </div>
  </div>
</template>

<script>
import EchartTrail from "./temp/cesium-2";
import flightData from "@/assets/json/plane.json";

export default {
  title: '轨迹图',
  name: "AppVisual",
  components: {EchartTrail},
  data() {
    return {
      lists: [],
      data: null,
      dataIndex: 0,
      timer: null,
      timer2: null,
    };
  },
  created() {

  },
  mounted() {
    clearInterval(this.timer2)
    clearInterval(this.timer)
    this.timer2 = setTimeout(() => {
      this.timer = setInterval(() => {
        if (this.dataIndex === flightData.length) {
          this.dataIndex = 0
        }
        let item = flightData[this.dataIndex]
        item.date = new Date()
        this.data = item
        this.dataIndex++
      }, 1000)
    }, 5000)
  },
  methods: {},
  beforeDestroy() {
    clearInterval(this.timer)
    clearInterval(this.timer2)
    this.timer = null
    this.timer2 = null
  }
};
</script>

<style lang="less" scoped>
  .app-data {
    height: 100%;
    width: 100%;
    padding: 15px;

    .cont-main {
      height: 100%;
      padding: 15px;
    }
  }
</style>>
